import {Component, OnInit, Input} from '@angular/core';
@Component({
    selector: 'app-star',
    templateUrl: './star.component.html',
    styleUrls: ['./star.component.css']
})
export class StarComponent implements OnInit {
    @Input()
    public getGrade:number = 0;
    public starArr:Array<boolean> = [true, true, true, true, true];

    constructor() {
    }

    ngOnInit() {
        let arr:Array<boolean> = this.starArr;
        this.starArr = arr.map((item, i)=> {
            if (this.getGrade <= i) {
                return false;
            }
            return true;
        });
    }
}
